PROGRAM MAPS
USE POLYMORPHIC_COMPLEXTAYLOR
TYPE(DAMAP) Id, MAP, A
REAL(DP) :: PREC = 1.D-10, xran
type(pbfield) F,FA
TYPE(VECFIELD) FT
type(ONELIEEXPONENT) SINGLE
INTEGER I

integer mf,me
mf=20
open(unit=mf,file='results.txt')
CALL INIT(NO1=4,ND1=2,NP1=0,NDPT1 =0)     !   <------------------ init for maps in ND1 degrees of freedom


call alloc(Id, MAP, A)
call alloc(F,FA);  CALL ALLOC(SINGLE); CALL ALLOC(FT);
xran=22.d0  ! seed
! Produce a random vector field with no constant parts
 call TAYLOR_ran(F%h,1.D0,XRAN)
 F%h=F%h/100.D0
 F%h=F%h -(F%h.SUB.1)-(F%h.SUB.0)


ID=1
MAP=TEXP(F,ID) 

CALL PRINT(MAP,MF)


! Producing a simple non-symplectic map

A=1
A=(0.95D0)*A

FT=A*F     ! TRANSFORMING THE VECTOR FIELD DIRECTLY

WRITE(MF,*) "FT "
CALL PRINT(FT,MF)

MAP=A**(-1)*MAP*A
SINGLE=MAP

WRITE(MF,*) "FT AGAIN"
CALL PRINT(SINGLE%VECTOR,MF)

DO I=1,C_%ND2
 FT%V(I)=FT%V(I)-SINGLE%VECTOR%V(I)
ENDDO

WRITE(MF,*) "  "
WRITE(MF,*) " COMPARING VECTOR FIELDS: THEY DO NOT AGREE "
WRITE(MF,*) "  "
CALL PRINT(FT,MF,PREC)

call kill(Id, MAP, A)
call kill(F,FA);  CALL kill(SINGLE); CALL kill(FT);

close(mf);
END PROGRAM MAPS

